<?php
//$a = unlink("uu/hanbao.png");
//if($a){
//    echo "删除成功！";
//}else{
//    echo "删除失败！";
//}

$server = "localhost";
$uname = "root";
$umm = "root";
$db = "maxik";
$con = mysqli_connect($server, $uname, $umm, $db);
if($con){
    $id = $_GET["id"];
    $sql = "select * from upload where id=".$id;
    $run = mysqli_query($con,$sql);
    if($run && mysqli_num_rows($run)>0){
        $kur = mysqli_fetch_assoc($run);
        $yuyux = unlink($kur['img']);
        if($yuyux){
            echo "头像删除成功！<br>";
            $sql = "delete from upload where id=".$id;
            $run = mysqli_query($con,$sql);
            if($run){
                echo "删除这条记录成功！";
            }
        }
    }
}else{
    echo "链接失败：".mysqli_connect_error();
}

